const env = process.env.NODE_ENV
const devApi = 'http://localhost:9099/api'
const proApi = 'http://www.simorp.top:9099/api'
const INSERT_YOUR_API_KEY_HERE = 'eBuH8yqyZr6XxxkQsyk3qk4A'

const colors = require('vuetify/es5/util/colors').default

module.exports = {
    mode: 'universal',
    /*
     ** Headers of the page
     */
    head: {
        // titleTemplate: '%s - ' + process.env.npm_package_name,
        title: process.env.npm_package_name || '',
        meta: [
            { charset: 'utf-8' },
            {
                name: 'viewport',
                content: 'width=device-width, initial-scale=1'
            },
            {
                hid: 'description',
                name: 'description',
                content: process.env.npm_package_description || ''
            }
        ],
        link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
    },
    server: {
        port: 9099,
        host: '0.0.0.0'
    },
    srcDir: 'src/',
    router: {
        routeNameSplitter: '/'
    },
    /*
     ** Customize the progress-bar color
     */
    loading: { color: '#fff' },
    /*
     ** Global CSS
     */
    css: [],
    /*
     ** Plugins to load before mounting the App
     */
    plugins: ['~/plugins/element-ui'],

    /*
     ** Nuxt.js modules
     */
    buildModules: ['@nuxtjs/vuetify'],
    modules: [
        // Doc: https://axios.nuxtjs.org/usage
        '@nuxtjs/axios'
    ],
    /*
     ** Axios module configuration
     ** See https://axios.nuxtjs.org/options
     */
    axios: {
        baseURL: env === 'development' ? devApi : proApi,
        retry: { retries: 2 }
    },
    /*
     ** vuetify module configuration
     ** https://github.com/nuxt-community/vuetify-module
     */
    vuetify: {
        customVariables: ['~/assets/variables.scss'],
        theme: {
            dark: false,
            themes: {
                dark: {
                    primary: colors.blue.darken2,
                    accent: colors.grey.darken3,
                    secondary: colors.amber.darken3,
                    info: colors.teal.lighten1,
                    warning: colors.amber.base,
                    error: colors.deepOrange.accent4,
                    success: colors.green.accent3
                }
            }
        }
    },
    /*
     ** Build configuration
     */
    build: {
        /*
         ** You can extend webpack config here
         */
        extend(config, ctx) { },
        vendor: ['element-ui']
    },
    env: {
        devApi: devApi,
        proApi: proApi,
        INSERT_YOUR_API_KEY_HERE: INSERT_YOUR_API_KEY_HERE
    },
    telemetry: false
}
